<include file="header" />
<link rel="stylesheet" href="/assets/base/quilt/css/style.css">
<body class="register-bg">
<div class="wraper bottom-none">
	<div class="load">
		<img class="load-bee" src="/assets/base/repair/images/load-bee.png"/>

	</div>
	<a href="javascript:history.back(-1)" class="back"><img src="/assets/base/center/images/return.png"/></a>
	<div class="identity"><img src="/assets/base/center/images/student.png"/></div>
	<div class="form-child clearfix">
		<span class="pull-left">姓名</span>
		<input class="pull-left" placeholder="请输入您的真实姓名" id="username" value="{BEESCRM:$data['username']}">
	</div>
	<div class="form-child clearfix">
		<span class="pull-left" style="width: 20%;">身份证</span>
		<input class="pull-left" placeholder="请输入您的身份证号码" style="width: 80%;" id="id_card" value="{BEESCRM:$data['id_card']}">
	</div>
	<div class="form-child clearfix">
		<span class="pull-left">手机</span>
		<input class="pull-left" placeholder="请输入您的手机号码" id="mobile" value="{BEESCRM:$data['mobile']}">
	</div>
	<div class="form-child clearfix">
		<span class="pull-left">专业</span>
		<input class="pull-left" placeholder="请输入您的专业" id="major" value="{BEESCRM:$data['major']}">
	</div>
	<div class="clearfix">
		<input type="hidden" id="goto_sub" value="1"/>
		<p style="width:100%;text-align: left;padding:15px 5% 0;font-size:14px;">
			<input type="checkbox" name="givecard" checked="checked" id="givecard_1" value="1" style="-webkit-appearance:checkbox;width: 18px;height: 18px;" class="givecard">
			<a href="javascript:void(0)" style="color:green;vertical-align: super;" id="movecard_1" class="givecard_text">免费寄送校园移动卡</a>
		</p>
	</div>
	<div class="pop-box tips" style="display: none" >
		<div class="main">
			<div class="text-container">
				<p class="text-16 text-center">关于移动校园卡</p>
				<p style="line-height: 28px;">
					<br>
					中国移动一直致力于打造良好的服务环境，优良的网络体验和最
					佳的用户感知。中国移动临安分公司和浙江农林大学合作已经超
					过10年，在这期间，有超过95%的学生和老师都选择了中国移动，
					老师，师兄师姐都爱移动圈，连隔壁校门口的商铺小哥用的也都
					是移动校园网，一个免费电话外卖送到宿舍。在移动和4G的飞速
					支撑下，QQ，微信无所不在，免费wifi覆盖宿舍，不用担心流量
					不够。临安移动浙江农林大学校区营业厅位于C区食堂对面，欢迎
					你来看看，可能会有小惊喜哦！
				</p>
			</div>
			<a href="javascript:void(0)" class="iknow">知道了</a>
		</div>
	</div>
	<div class="pop-box tips" style="display: none" id="submit_box">
		<div class="main" style="height:auto;padding-bottom:0;margin-top:40%;">
			<p class="text-16 text-center">注册提醒</p>
			<div class="text-container text-center" style="padding: 15px 12px;">
				是否确认提交？
			</div>
			<div class="iknow clearfix">
				<a href="javascript:void(0)" id="submit" style="width: 50%;display: block;text-align: center;float: left;color: green;">确定</a>
				<a href="javascript:void(0)" id="cancel" style="width: 50%;display: block;text-align: center;float: left;color: green;">取消</a>
			</div>
		</div>
	</div>
	<a href="#" class="register-btn"><img src="/assets/base/center/images/btn.png"/></a>
    <if condition="$remark">
        <include file="remark"/>
    </if>
	<div class="bottom-box">
		<p class="copyright">杭州青橄榄网络技术有限公司 技术支持</p>
	</div>
</div>

<include file="commonJS" />
<script>
	var height = $(window).height();
	var bottombox_height = $('.bottom-box').outerHeight();
	$('.wraper').css("minHeight",height);
	$('.wraper').css("paddingBottom",bottombox_height);

	//校园卡弹出
	$('#movecard').on('click',function(){
		$("#goto_sub").val(1);
		//$('.tips').show();
	});

	$('.givecard').click(function(){
		if ($(this).prop('checked') == false) {
			$('.givecard').prop('checked', false);
		}else{
			$('.givecard').prop('checked', false);
			$(this).prop('checked', true);
		}
	});

	$('.givecard_text').click(function(){
		if ($(this).parent().find('.givecard').prop('checked') == true) {
			$('.givecard').prop('checked', false);
		}else{
			$('.givecard').prop('checked', false);
			$(this).parent().find('.givecard').prop('checked', true);
		}
	});

	$('#submit').on('click',function(){
		var goto = $("#goto_sub").val();
		$('.tips').hide();
		if(goto == 2){
			var data={};
			//var check = $("input[type='checkbox']").is(':checked');
			var check = 0;
			if ($('#givecard_1').is(':checked')){
				check = 1;
			}else if ($('#givecard_2').is(':checked')){
				check = 2;
			}
			var is_give = check;
			data.real_name=$('#username').val();
			data.mobile=$('#mobile').val();
			data.major=$('#major').val();
			data.id_card=$('#id_card').val();
			data.is_give = is_give;
			data.type=0;
			var json={};
			json.method='post';
			json.type='json';
			json.url="{BEESCRM::U('/base/User/doNewborn',array('account_id'=>$accountId ,'type' => 1))}";
			json.data=data;
			$.getAjax(json,true,reload,'');
		}
	});

	$('#cancel').click(function(){
		$('#submit_box').hide();
	});

	$(function(){
		$('.register-btn').click(function(){
			var data={};
			var verify_method = /^(?:13\d|15\d|18\d|17\d|14\d)\d{5}(\d{3}|\*{3})$/;
			var check = 0;
			if ($('#givecard_1').is(':checked')){
				check = 1;
			}else if ($('#givecard_2').is(':checked')){
				check = 2;
			}
			data.real_name=$('#username').val();
			data.mobile=$('#mobile').val();
			data.major=$('#major').val();
			data.id_card=$('#id_card').val();
			if (!data.real_name) {
				$.alert('error','姓名不能为空');
				return false;
			}
			if (data.id_card == '') {
				$.alert('error','身份证号码不能为空');
				return false;
			}
			if (data.id_card.length != 15){
				if(data.id_card.length != 18){
					$.alert('error','请输入正确的身份证号码');
					return false;
				}
			}
			if(!data.mobile){
				$.alert('error','手机号不能为空');
				return false;
			}
			if (!verify_method.test(data.mobile)) {
				$.alert('error','请输入正确的手机号');
				return false;
			}
			if (!data.major){
				$.alert('error','专业不能为空');
				return false;
			}
			$("#goto_sub").val(2);
			//$('.tips').show();
			$('#submit_box').show();
		});

	})
	function reload(data){
		var type = data.type;
		if (data.is_give == 0) {
			location.href = "{BEESCRM::U('/base/User/tips',array('account_id'=>$accountId))}/type/" + type;
			//var url = "{BEESCRM::U('base/center/center',array('account'=>$accountId))}";
		}else if (data.is_give == 1){
			location.href = "http://wap.zj.10086.cn/shop/shop/student/studentBand/queryStudentIndex.do?ch=31&parameter=zSm0tmC%2bz3Md%2bqybVF8TpJbIjuPQ%2b64mw7VP3hTjb16dd44I7FhKyedm%2b7Kf%2bzKS";
		}
		//setTimeout("location.href ='{BEESCRM::U('base/center/center',array('wechat_id'=>$wechat_id))}'", 2000);
	}
</script>
</body>
</html>